Skip to content

feat: drag and drop elements on android - #122

Merged
IvanIhnatsiuk merged 2 commits into
developmentfrom
feat/drag-and-drop-elements-on-android
Jul 15, 2026
Merged

feat: drag and drop elements on android#122
IvanIhnatsiuk merged 2 commits into
developmentfrom
feat/drag-and-drop-elements-on-android

Conversation

@IvanIhnatsiuk

@IvanIhnatsiuk IvanIhnatsiuk commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

This pull request introduces drag-and-drop support for text selection in the EnrichedTextInputView, enabling users to drag selected text within the input field. The main changes involve implementing a new handler for drag operations, integrating it into the view, and refining utility code for pixel density calculations.

Drag-and-drop support for text selection:

  • Added a new EnrichedDragHandler class that manages drag-and-drop operations, including starting drags on long-press, handling drops, and deleting the source text after a local drag-and-drop. (android/src/main/java/com/swmansion/enriched/EnrichedDragHandler.kt)
  • Integrated EnrichedDragHandler into EnrichedTextInputView by delegating onDragEvent, performLongClick, and onTouchEvent to the handler, ensuring seamless drag-and-drop interactions. (android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt)

Utility improvements:

  • Updated the dp extension property for Int to return an Int value based on the system's display metrics, improving pixel density calculations for UI elements like drag shadows. (android/src/main/java/com/swmansion/enriched/utils/Numbers.kt)

Minor code quality improvements:

  • Replaced manual casting of text to SpannableStringBuilder with the safer editableText property in EnrichedTextInputView. (android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt)
  • Added missing import for DragEvent to support drag-and-drop handling. (android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt)

Test Plan

  1. Open the editor screen
  2. Select any text
  3. Hold the press on it
  4. Drag and drop it to any place

Screenshots / Videos

Screen.Recording.2026-07-14.at.15.55.56.mov

Compatibility

OS Implemented
iOS
Android ✅❌

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Android drag-and-drop support for moving selected text within EnrichedTextInputView, by introducing a dedicated drag handler and wiring it into the view’s touch/drag lifecycle. This extends the Android editor interaction model while keeping insertion/deletion logic in existing clipboard/transaction utilities.

Changes:

  • Introduces EnrichedDragHandler to start selection drags (long-press), handle drops, and remove the source text after local drops.
  • Integrates drag handling into EnrichedTextInputView (onDragEvent, performLongClick, and onTouchEvent).
  • Updates the Int.dp helper to return pixel Ints (used for drag shadow sizing/padding).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
apps/example/ios/Podfile.lock Bumps ReactNativeEnriched pod version/checksum to match the new release.
android/src/main/java/com/swmansion/enriched/utils/Numbers.kt Changes Int.dp to return Int pixels for UI sizing helpers.
android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt Wires drag handler into view lifecycle and uses editableText for safer text operations.
android/src/main/java/com/swmansion/enriched/EnrichedDragHandler.kt New drag-and-drop implementation for moving selected text and managing drag shadow UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread android/src/main/java/com/swmansion/enriched/utils/Numbers.kt Outdated
Comment thread android/src/main/java/com/swmansion/enriched/EnrichedDragHandler.kt Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

Comment thread android/src/main/java/com/swmansion/enriched/utils/Numbers.kt
Comment thread android/src/main/java/com/swmansion/enriched/EnrichedDragHandler.kt
@IvanIhnatsiuk
IvanIhnatsiuk merged commit d90e0b5 into development Jul 15, 2026
1 check passed
@IvanIhnatsiuk
IvanIhnatsiuk deleted the feat/drag-and-drop-elements-on-android branch July 15, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants